import axios from '@/api/fetch';
//import * as types from './types';
import SERVER from '@/api/server';

//旧件回运仓库维护-按主损件-主机厂

//旧件回运仓库维护-按主损件-主页面查询
export const getListByPage = params => axios.post(`${SERVER.CLAIMFAC}/rPReturnWhMp/getListByPage`,  params );
//新增的保存
export const newSave = params => axios.post(`${SERVER.CLAIMFAC}/rPReturnWhMp/saveOne`,  params );
//批量启动
export const piliangqiyong = data => axios.post(`${SERVER.CLAIMFAC}/rPReturnWhMp/updateEnableByIds`,  null ,{params : data} );
//批量停用
export const piliangtingyong = data => axios.post(`${SERVER.CLAIMFAC}/rPReturnWhMp/updateEnableByIds`,  null ,{params : data} );
//Excel导出
// export const excelExport = params => axios.get(`${SERVER.CLAIMFAC}/rPReturnWhMp/getListForExport`, params);
// export const excelExport = params => axios.post(`${SERVER.CLAIMFAC}/rPReturnWhMp/getListForExport`,  params );

export const excelExport = params => {
  return axios({
    url:`${SERVER.CLAIMFAC}/rPReturnWhMp/getListForExport`,
    method: 'get',
    params: params,
    responseType: 'blob'
  });
};
//一般车辆配件类型保修期编辑弹窗的保存
export const editSave = params => axios.post(`${SERVER.CLAIMFAC}/rPReturnWhMp/updateByPtId`,  params );



//导出模版
export const downloadModel = params => {
  const url = `${SERVER.CLAIMFAC}/rPReturnWhMp/exportModel`;
  return axios({
    url,
    method: 'post',
    responseType: 'blob'
  });
};

//导出
export const getListForExport = (params) => axios.post(`${SERVER.CLAIMFAC}/rPReturnWhMp/getListForExport`, params, {
  responseType: 'blob'
});

//下载中心导出
export const exporturl = params => axios.post(`/api/cmscloud.excel/downloadExcel/exportExcel/${params.CODE}`, params);

//仓库代码取得
export const getWarehouseList = params =>
  axios.post(`${SERVER.CLAIMFAC}/rPReturnWh/getListByPage`,
    params
  );
//配件代码查询
export const getPartList = params =>
  axios.get(`${SERVER.CLAIMFAC}/const/getPartList`, {
    params
  });
export const getTjdetail = params =>
  axios.get(`${SERVER.CLAIMFAC}/rPReturnWhMp/selectById/${params.id}`, {
    params
  });
